package com.team.kaidb;

import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.Window;

import butterknife.ButterKnife;


/**
 * Created by maizi on 15/5/26.
 */
public abstract class BaseActivity extends Activity {
    protected String TAG = getClass().getSimpleName();


    protected Context context;
    protected Activity activity;
    /**屏幕高度
     */
    protected int height;
    /**屏幕宽度
     */
    protected int width;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;
        activity = this;
        setUpWindow();
        initSize();
        setContentView(getLayoutId());
        ButterKnife.inject(this);
    }
    public abstract int getLayoutId();
    /**设置全屏
     */
    private void setUpWindow() {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // 禁止横屏
    }
    /**获取屏幕尺寸
     */
    private void initSize() {
        DisplayMetrics mDisplayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);
        width = mDisplayMetrics.widthPixels;
        height = mDisplayMetrics.heightPixels;
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

}
